﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using QUANLIBANHANG.DAL;
using QUANLIBANHANG.ENTITY;

namespace QUANLIBANHANG.BUS
{
    public class KhachHangBUS
    {

        // insert khách hàng
        public static void insertKH(KhachhangEntity kh)
        {
            try
            {

                KhachHangDAL.insertKH(kh);
            }
            catch (Exception e)
            {
                
                throw e;
            }
            
        }
        // Update khách hàng
        public static void updateKH(KhachhangEntity kh)
        {
            try
            {
                KhachHangDAL.updateKh(kh);
            }
            catch (Exception e)
            {
                
                throw e;
            }
            
        }
        // Delete khách hang
        public static void deleteKH(KhachhangEntity kh)
        {
            try
            {
                KhachHangDAL.deleteKH(kh);
            }
            catch (Exception e)
            {
                
                throw e;
            }
            
        }

        public static DataTable getTableKH(string dk)
        {
            try
            {
                return KhachHangDAL.getTableKH(dk);
            }
            catch (Exception e)
            {
                
                throw e;
            }
            
        }

        //public static DataRow getRowKH(string dk)
        //{
        //    try
        //    {
        //        return KhachHangDAL.getRowKH(dk);
        //    }
        //    catch (Exception ex)
        //    {
                
        //        throw ex;
        //    }
        //}
       
        public static DataTable getTopKH()
        {
            try
            {
               return KhachHangDAL.getTopKH();
            }
            catch ( Exception ex)
            {
                
                throw ex;
            }
        }

        
    }
}
